import java.util.*;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: a1227
 * Date: 2022-09-12
 * Time: 23:07
 */
public class Test {
    //BC156 牛牛的数组匹配
    /*
    public static int minNum(int suma,int sumb){
        if(suma >= sumb){
            return suma - sumb;
        }else{
            return sumb - suma;
        }
    }

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int[] a = new int[n + 1];
        Arrays.fill(a,0,a.length,0);
        for(int i = 0; i < n; i++){
            a[i] = scan.nextInt();
        }
        int[] b = new int[m + 1];
        Arrays.fill(b,0,b.length,0);
        for(int i = 0; i < m; i++){
            b[i] = scan.nextInt();
        }
        int suma = 0;
        for(int i = 0; i < n; i++){
            suma += a[i];
        }
        int min = suma;
        int start = 0;
        int end = 0;
        for(int i = 0; i < m; i++){
            int sumb = b[i];
            for(int j = i + 1; j < b.length; j++){
                if(minNum(suma,sumb) < min){
                    min = minNum(suma,sumb);
                    start = i;
                    end = j;
                }
                sumb += b[j];
            }
        }
        for(int i = start; i < end; i++){
            System.out.print(b[i]+" ");
        }
    }
    */
}
